package com.dgshanger.sanhxiaofeisc.mvp.presenter

import com.dgshanger.sanhxiaofeisc.mvp.contract.EnterProtocolContract
import com.dgshanger.sanhxiaofeisc.mvp.model.EnterProtocolModel
import com.xx.baseuilibrary.mvp.BaseMvpPresenter
import com.xx.baseutilslibrary.network.rx.XxBaseHttpObserver

/**
 * Created by JacobHHH on 2018/4/20.
 */
class EnterProtocolPresenter : BaseMvpPresenter<EnterProtocolContract.Model, EnterProtocolContract.View>(), EnterProtocolContract.Presenter {

    override fun loadData() {

        getModel().loadData(object : XxBaseHttpObserver<String>(){

            override fun onCompleted(msg: String?, entity: String?) {
                getView()?.setData(entity)
            }

            override fun onError(error: String?) {
                getView()?.showError(Throwable(error),true)
            }

            override fun onStart() {

            }

            override fun onFinish() {

            }



        })
    }

    override fun createModel(): EnterProtocolContract.Model = EnterProtocolModel()
}